namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;

    using Entities;
    using List;

    using System.Data;

    using SharePoint.Wss.Lists;

    using TestHelper=Collaboris.Saf.Actions.Wss.Tests.TestHelper;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class ImportDataSetToListInfoTest
    {
        [TestMethod]
        public void ImportDataSetToListInfo_Test()
        {
            WSSTestAssistant<ImportDataSetToList, ImportDataSetToListInfo> importDataSetToList =
                    new WSSTestAssistant<ImportDataSetToList, ImportDataSetToListInfo>(TestEnvironment.PublishingSite,
                        "ImportDataSetToListWeb", "BLANKINTERNET#0");

            using (importDataSetToList)
            {
                TestHelper.CreateTasksList(importDataSetToList.TestWeb, true, false);

                DataSet dataSet = new DataSet("someDataSet");
                DataTable dataTable = dataSet.Tables.Add();            

                //-- Add columns to the data table            
                dataTable.Columns.Add("Title", typeof(string));            
                dataTable.Columns.Add("Description", typeof(string));            
                
                
                //-- Add rows to the data table            
                dataTable.Rows.Add("Task 1", "Task 1 Desc");
                dataTable.Rows.Add("Task 2", "Task 2 Desc");
                
                //importDataSetToList.Context.ContextProperties.Add("CSVDataSet", dataSet);
                importDataSetToList.FirstEntity.Data = dataSet;

                MacroReport doReport = importDataSetToList.DoMacro();

                SPList list = SPListHelper.GetList(importDataSetToList.TestWeb, "TestTasks", false);

                Assert.IsNotNull(list.Items[0]["Title"].ToString() == "Task 1");
                Assert.IsNotNull(list.Items[1]["Title"].ToString() == "Task 2");
                Assert.IsNotNull(list.Items[0]["Description"].ToString() == "Task 1 Desc");
                Assert.IsNotNull(list.Items[1]["Description"].ToString() == "Task 2 Desc");
                

                
            }
        }
    }
}
